<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>文章管理</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>public/css/base.css">

        <script language="javascript">
            function selAll()
            {
                for(i=0;i<document.form2.arcID.length;i++)
                {
                    if(!document.form2.arcID[i].checked)
                        {
                        document.form2.arcID[i].checked=true;
                    }
                }
            }
            function noSelAll()
            {
                for(i=0;i<document.form2.arcID.length;i++)
                {
                    if(document.form2.arcID[i].checked)
                        {
                        document.form2.arcID[i].checked=false;
                    }
                }
            }
            function delArc(aid){
                var qstr=getCheckboxItem();
                if(aid==0) aid = getOneItem();
                location="<?php echo site_url("admin/archives/del")?>"+"?qstr="+qstr+"&aid="+aid+"&dopost=delArchives";
            }
            //获得选中文件的文件名
            function getCheckboxItem()
            {
                var allSel="";
                if(document.form2.arcID.value) return document.form2.arcID.value;
                for(i=0;i<document.form2.arcID.length;i++)
                {
                    if(document.form2.arcID[i].checked)
                        {
                        if(allSel=="")
                            allSel=document.form2.arcID[i].value;
                        else
                            allSel=allSel+"`"+document.form2.arcID[i].value;
                    }
                }

                return allSel;
            }

            //获得选中其中一个的id
            function getOneItem()
            {
                var allSel="";
                if(document.form2.arcID.value) return document.form2.arcID.value;
                for(i=0;i<document.form2.arcID.length;i++)
                {
                    if(document.form2.arcID[i].checked)
                        {
                        allSel = document.form2.arcID[i].value;
                        break;
                    }
                }
                return allSel;
            }
			
		
        </script>
    </head>
    <body leftmargin="8" topmargin="8" background='<?php echo base_url();?>public/images/allbg.gif' onLoad="ContextMenu.intializeContextMenu()">

        <!--  快速转换位置按钮  -->
        <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ccd9b9" align="center">
            <tr>
                <td height="26" background="<?php echo base_url();?>public/images/newlinebg3.gif">
                    <table width="98%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="left">
                                <input type='button' class="coolbg np" onClick="location='<?php echo site_url("admin/archives/add?typeid=").$this->input->get('typeid',true)?>';" value='添加文章' />
                                <input type='button' class="coolbg np" onClick="location='<?php echo site_url("admin/sort")?>';" value='分类管理' />

                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>

        <!--  内容列表   -->
        <form name="form2">
            <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CFCFCF" align="center" style="margin-top:8px">
            <tr bgcolor="#E7E7E7" >
                <td height="28" colspan="10" background="<?php echo base_url();?>public/images/tbg.gif" style="padding-left:10px;">
                    ◆ 所有分类&gt;文章列表 &nbsp;
                </td>
            </tr>
            <tr align="center" bgcolor="#FBFCE2" height="25">
                <td width="4%">ID</td>
                <td width="4%">选择</td>
                <td width="44%">文章标题</td>
                <td width="12%">更新时间</td>
                <td width="8%">分类</td>

                <td width="18%">发布人</td>
                <td width="8%">操作</td>
            </tr>

            <?php   
                if ($list->num_rows() > 0)
                {
                    foreach ($list->result() as $a_list)
                    {


                    ?>
                    <tr align='center' bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                        <td nowrap>
                        <?php echo $a_list->id;?>    </td>
                        <td>
                            <input name="arcID" type="checkbox" id="arcID" value="<?php echo $a_list->id;?> " class="np" />
                        </td>
                        <td align='left'>
                            <span id="arc107">

                                <u><a href="<?php echo site_url("admin/archives/modify?id=$a_list->id");?>"><?php echo $a_list->title;?></a></u>

                            </span>
                            <?php
                                if(!empty($a_list->flag)) 
                                {
                                    echo '[<font color=\'red\'>';
                                    $arr_attname='';
                                    foreach ($arcatt_all_list->result() as $arcatt)
                                    {
                                        if(preg_match("#".$arcatt->att."#", $a_list->flag))
                                        {
                                            $arr_attname=$arr_attname.$arcatt->attname.' ';
                                        }
                                    }
                                    echo rtrim($arr_attname,' ');
                                    echo '</font>]';
                                }
                            ?>

                        </td>
                        <td><?php echo date('Y-m-d h:i:s',$a_list->uptime);?> </td>
                        <td><a href='<?php echo site_url("admin/archives/?typeid=$a_list->typeid&typeflag=1");?>'><?php echo $a_list->cname;?></a></td>
                        <td><?php echo $a_list->writer;?> </td>
                        <td>
                          
                            <img src='<?php echo base_url();?>public/images/gtk-edit.png' title="编辑" alt="编辑" onClick="location='<?php echo site_url("admin/archives/modify?id=$a_list->id");?>';" style='cursor:pointer' border='0' width='16' height='16' />
							
							 <a href="<?php echo site_url("admin/archives/del?qstr=$a_list->id&aid=0&dopost=delArchives")?>"> <img src='<?php echo base_url();?>public/images/gtk-del.png' title="删除" alt="删除" onClick="return confirm('是否将此数据删除?')" style='cursor:pointer' border='0' width='16' height='16' /></a>
							
                           <a href="<?php echo site_url("home/home/detail?id=$a_list->id");?>" target="_blank"> <img src='<?php echo base_url();?>public/images/part-list.gif' title="预览" alt="预览"  style='cursor:pointer' border='0' width='16' height='16' /></a>
                        </td>
                    </tr>
                    <?

                    }
                }
            ?>


            <tr bgcolor="#ffffff">
                <td height="36" colspan="7">
                    &nbsp;
                    <a href="javascript:selAll()" class="coolbg">全选</a>
                    <a href="javascript:noSelAll()" class="coolbg">取消</a>
                    <a href="javascript:delArc(0)" class="coolbg">&nbsp;删除&nbsp;</a>
                </td>
            </tr>
        </form>
        <tr align="right" bgcolor="#F9FCEF">
            <td height="36" colspan="7" align="center">
                <span><div class="pagination"><?php echo $page;?></div></span>
            </td>
        </tr>
        </table>

        <!--  搜索表单  -->
        <form name='form3' action='<?php echo site_url("admin/archives")?>' method='get'>
            <input type='hidden' name='dopost' value='listArchives' />
            <table width='98%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#cfcfcf' align="center" style="margin-top:8px">
                <tr bgcolor='#EEF4EA'>
                    <td background='<?php echo base_url();?>public/images/wbg.gif' align='center'>
                        <table border='0' cellpadding='0' cellspacing='0' height="32">
                            <tr>
                                <td width='160'>
                                    <select name='typeid' id='typeid'>
                                        <option value='0'>请选择栏目...</option>
                                        <?php
                                            if ($treelist->num_rows() > 0)
                                            {
                                                foreach ($treelist->result() as $row)
                                                {
                                                    $s_count=count(explode('-',$row->path));
                                                    $s_length='';
                                                    for($i=1;$i<$s_count;$i++)
                                                    {
                                                        $s_length=$s_length.'─';
                                                    }
                                                    $s_select='';
                                                    if($row->id==$this->input->get('typeid',true))
                                                    {
                                                        $s_select='selected=\'selected\'';
                                                    }
                                                    echo " <option value='".$row->id."' ".$s_select.">".$s_length.$row->name."</option>";
                                                }
                                            }
                                        ?>

                                    </select>
                                </td >
                                <td nowrap>
                                    关键字：
                                </td>
                                <td width='130'>
                                    <input type='text' name='keyword' value='<?echo $this->input->get('keyword',true)?>' style='width:120px' />
                                </td>
                                <td width='10'>

                                </td>
                                <td width='90'>
                                    <select name='flag' style='width:80px'>
                                        <option value=''>属性...</option>
                                        <?
                                            foreach ($arcatt_all_list->result() as $arcatt)
                                            {
                                                 $s_select='';
                                                if($arcatt->att==$this->input->get('flag',true))
                                                {
                                                     $s_select='selected=\'selected\'';
                                                }

                                                echo " <option value='$arcatt->att' $s_select>$arcatt->attname</option>"; 

                                            }
                                        ?>

                                    </select>
                                </td>
                                <td>
                                    <input name="imageField" type="image" src="<?php echo base_url();?>public/images/button_search.gif" width="60" height="22" border="0" class="np" />    

                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </form>

    </body>
</html>